/**
 * 添加设备点检
 * author Luogan
 */
import React, { useEffect } from 'react'
import { connect } from 'dva'
import { KeepAlive } from 'react-activation'
import Plan from '../component/plan'

function Add({ dispatch, location: { query }, commonAction: { catchObj } }) {
  useEffect(() => {
    dispatch({
      type: 'commonAction/uploadCatch',
      payload: {
        catchObj: {
          deviceCheck_edit: [true, false]
        }
      }
    })
  }, [dispatch])
  return (
    <KeepAlive name='deviceCheck_edit' when={catchObj.deviceCheck_edit}>
      <div className="deviceCheck_add">
        <Plan query={query} />
      </div>
    </KeepAlive>
  )
}
export default connect(({ deviceCheck, commonAction }) => ({
  deviceCheck, commonAction
}))(Add)